package com.nineclock.message.listener;

import afu.org.checkerframework.checker.units.qual.A;
import com.nineclock.message.pojo.NcMessage;
import com.nineclock.message.service.MessageService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

@Component
@Slf4j
@RocketMQMessageListener(topic = "messagePushTopic",consumerGroup = "messagePushConsumer")
public class MsgConsumerListener implements RocketMQListener<NcMessage> {

    @Autowired
    MessageService messageService;

    @Override
    public void onMessage(NcMessage message) {
        try {
            messageService.pushSingMessage(message);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
